package kr.co.shoppingmall.reviewboard;

import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class ReviewBoardDAOImpl extends SqlMapClientDaoSupport implements ReviewBoardDAO {

	@Override
	public void insertReviewBoard(ReviewBoardDTO dto) {
		getSqlMapClientTemplate().insert("insertReviewBoard", dto);
	}

	@Override
	public List getReviewBoardList(HashMap map) {
		return getSqlMapClientTemplate().queryForList("getReviewBoardList", map);
	}

	@Override
	public int getReviewCount() {
		return (int) getSqlMapClientTemplate().queryForObject("getReviewCount");
	}

	@Override
	public ReviewBoardDTO getReviewBoard(int rboard_num) {
		return (ReviewBoardDTO)
			getSqlMapClientTemplate().queryForObject("getReviewBoard", rboard_num);
	}

	@Override
	public void updateReviewBoardHit(int rboard_num) {
		getSqlMapClientTemplate().update("updateReviewBoardHit", rboard_num);		
	}

	@Override
	public void updateReviewBoard(ReviewBoardDTO dto) {
		getSqlMapClientTemplate().update("updateReviewBoard", dto);
	}

	@Override
	public void deleteReviewBoard(ReviewBoardDTO dto) {
		getSqlMapClientTemplate().delete("deleteReviewBoard", dto);
	}

	@Override
	public void updateReviewReply(ReviewBoardDTO dto) {
		getSqlMapClientTemplate().update("updateReviewReply", dto);
	}

	@Override
	public void insertReviewReply(ReviewBoardDTO dto) {
		getSqlMapClientTemplate().insert("insertReviewReply", dto);
	}

}
